package great.project.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * <div  style="border:2px solid none;margin:20px;padding:15px;font-size:24px;text-align:center;color:aqua;">
 *
 *
 *
 *  </div>
 *
 * @author zhangshun
 * @date 2021/2/5 16:26
 */
@Data
public class User {

	@NotBlank(message = "姓名不能为空")
	private String username;

	@Length(min = 6, max = 16, message = "密码长度为6-16位")
	@NotBlank(message = "密码不能为空")
	private String password;

	@Pattern(regexp = "0?(13|14|15|17|18|19)[0-9]{9}", message = "手机号格式不正确")
	private String phone;

	/**
	 * 嵌套必须加 @Valid，否则嵌套中的验证不生效
	 */
	@Valid
	@NotNull(message = "userinfo不能为空")
	private UserInfo userInfo;

}